#ifndef _SINGLETON_H
#define _SINGLETON_H

#define NULL 0


#ifdef GALLIUMENGINE_DLL 
#define GALLIUMENGINE_API __declspec( dllexport )
#else
#define GALLIUMENGINE_API __declspec( dllimport )
#endif

namespace GalliumEngine
{

	template <typename T>
	class GALLIUMENGINE_API Singleton
	{
	public:
		Singleton<T>(void)
		{    
		}
 
		static inline T* getInstance(void) 
		{ 
			if(instance == NULL) 
			{
				instance = new T();
			}
			return instance;
		} 

		static inline bool exists( void ) { return instance != 0; }
   
		virtual ~Singleton( void ) { instance = 0; }

	private:
		static T* instance;
	};
}

#endif

